import api from '../../server/api';

const state = {
    gettotal:"",
    getrateTags:[],
    getlist:[],
    getnull:[]
}

const getters = {}

const actions = {
    // 由type页面跳转调用的方法
    GetComment( {commit} ,itemId){
        api.LoadDataByComment({
            type:1,
            appPlat:"m",
            itemId
        })
        .then(( result )=>{
            console.log(result)
            if(result.data){
                commit("setGettotal",result.data.total);
                commit("setGetrateTags",result.data.rateTags);
                commit("setGetlist",result.data.list); 
            }else{
                commit("setGettotal",result.data);
                commit("setGetrateTags",result.data);
                commit("setGetlist",result.data); 
            }
        })
    },
  
}
    
const mutations = {
    setGettotal(state,data){
        state.gettotal = data
    }, 
    setGetrateTags(state,data){
        state.getrateTags = data
    },
    setGetlist(state,data){
        state.getlist = data
    },
    setGetnull(state,data){
        state.getnull = data
    },
   
}

export default {
    state,
    actions,
    mutations,
    getters
}
